//
// Decompiled by Jadx - 501ms
//
package fo;

import a.g;
import a.i;
import android.text.TextUtils;
import fm.f;
import fn.y;
import me.plusne.GreenDao.dao.GetValueVersionDao;
import me.plusne.common.Json.JsonHookStatic;
import org.luckypray.dexkit.result.ClassData;
import org.luckypray.dexkit.result.MethodData;

public final class b {
    public static int a;

    public static ClassData b(int i) {
        String e = e("cache_data_" + i);
        if (TextUtils.isEmpty(e)) {
            return null;
        }
        try {
            return y.by.getBridge().getClassData(e);
        } catch (IllegalAccessError e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static int c() {
        int i = a + 1;
        a = i;
        return i;
    }

    public static MethodData d(int i) {
        String e = e("cache_data_" + i);
        if (TextUtils.isEmpty(e)) {
            return null;
        }
        try {
            return y.by.getBridge().getMethodData(e);
        } catch (IllegalAccessError e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static String e(String str) {
        JsonHookStatic jsonHookStatic = y.by;
        GetValueVersionDao getValueVersionDao = jsonHookStatic.getDb().t;
        getValueVersionDao.getClass();
        g gVar = new g(getValueVersionDao);
        gVar.l(GetValueVersionDao.Properties.Key.f(str), new i[]{GetValueVersionDao.Properties.LastUpdateTime.f(Long.valueOf(jsonHookStatic.getLastUpdateTime())), GetValueVersionDao.Properties.MainVersionCode.f(Long.valueOf(jsonHookStatic.getMainVersionCode())), GetValueVersionDao.Properties.VersionCode.f(Long.valueOf(jsonHookStatic.getVersionCode())), GetValueVersionDao.Properties.MainVersionName.f(jsonHookStatic.getMainVersionName())});
        gVar.i(1);
        f fVar = (f) gVar.k();
        if (fVar == null) {
            return null;
        }
        return fVar.c;
    }

    public static void f(int i, String str) {
        g("cache_data_" + i, str);
    }

    public static void g(String str, String str2) {
        JsonHookStatic jsonHookStatic = y.by;
        GetValueVersionDao getValueVersionDao = jsonHookStatic.getDb().t;
        getValueVersionDao.getClass();
        g gVar = new g(getValueVersionDao);
        gVar.l(GetValueVersionDao.Properties.Key.f(str), new i[]{GetValueVersionDao.Properties.LastUpdateTime.f(Long.valueOf(jsonHookStatic.getLastUpdateTime())), GetValueVersionDao.Properties.MainVersionCode.f(Long.valueOf(jsonHookStatic.getMainVersionCode())), GetValueVersionDao.Properties.VersionCode.f(Long.valueOf(jsonHookStatic.getVersionCode())), GetValueVersionDao.Properties.MainVersionName.f(jsonHookStatic.getMainVersionName())});
        gVar.i(1);
        f fVar = (f) gVar.k();
        if (fVar == null) {
            f fVar2 = new f();
            fVar2.b = str;
            fVar2.c = str2;
            fVar2.f = jsonHookStatic.getLastUpdateTime();
            fVar2.e = jsonHookStatic.getMainVersionCode();
            fVar2.d = jsonHookStatic.getVersionCode();
            fVar2.g = jsonHookStatic.getMainVersionName();
            jsonHookStatic.getDb().j(fVar2);
            return;
        }
        fVar.c = str2;
        jsonHookStatic.getDb().l(fVar);
    }
}
